package com.atguigu.day21.charstream03;

import org.junit.Test;

import java.io.*;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/11/26 14:46
 * @注释
 */
public class Exer {
    @Test
    public void test01() {
        try (Reader r = new FileReader("D:/年度最佳小说.txt");
             Writer w = new FileWriter("D:/Games/a.txt")
        ) {
            char[] cArr = new char[1024];
            int length = 0;
            while ((length = r.read(cArr)) != -1) {
                w.write(cArr, 0, length);
            }
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }


}
